package com.ucap.bbs.service.impl;

import java.util.List;

import com.ucap.bbs.dao.IUsersDao;
import com.ucap.bbs.pojo.Users;
import com.ucap.bbs.service.IUsersService;
import com.ucap.bbs.util.MD5;
import com.ucap.bbs.util.bean.LoginUesrBean;

public class UsersServerImpl implements IUsersService {

	private IUsersDao usersDao;
	
	public void setUsersDao(IUsersDao usersDao) {
		this.usersDao = usersDao;
	}

	@Override
	public List<Users> test() {
		List<Users> users = this.usersDao.test();
		return users;
	}

	@Override
	public Users login(String loginName, String loginPwd) {
		//封装密码
		Users users = new Users();
		users.setLoginName(loginName);
		users.setLoginPwd(MD5.encrypt(loginPwd));
		
		return this.usersDao.login(users);
	}

	@Override
	public void insert(Users users) {
		users.setLoginPwd(MD5.encrypt(users.getLoginPwd()));
		this.usersDao.insert(users);
	}

}
